package com.example.blueconn;

import android.app.Application;
import android.content.Context;

import com.clj.fastble.BleManager;
import com.clj.fastble.scan.BleScanRuleConfig;
import com.example.blueconn.manager.ActivityMgr;
import com.example.blueconn.utils.SPLightUtils;
import com.example.blueconn.utils.SPUtils;
import com.qmuiteam.qmui.arch.QMUISwipeBackActivityManager;

import java.util.UUID;

public class App extends Application {

    private static Context context;

    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();
        QMUISwipeBackActivityManager.init(this);
        BleManager.getInstance().init(this);
        BleManager.getInstance()
                .enableLog(true)
                .setReConnectCount(1, 5000)
                .setSplitWriteNum(20)
                .setConnectOverTime(10000)
                .setOperateTimeout(5000);

        SPUtils.init(this);
        SPLightUtils.init(this);

//        BleScanRuleConfig scanRuleConfig = new BleScanRuleConfig.Builder()
//                .setServiceUuids(new UUID[]{Constant.SERVICE_UUID})
//                .setDeviceMac(mac)
//                .setAutoConnect(true)
//                .setScanTimeOut(10000)
//                .build();
//        BleManager.getInstance().initScanRule(scanRuleConfig);
//        SkinManager.install(this);
//        QMUISkinMaker.init(context,
//                new String[]{"com.qmuiteam.qmuidemo"},
//                new String[]{"app_skin_"}, R.attr.class);

        registerActivityLifecycleCallbacks(ActivityMgr.getInstance());
    }

    public static Context getContext() {
        return context;
    }
}
